home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_2 / interfaces / willy-ttx / quicksort-source / qsorttest.rexx < prev    next >
OS/2 REXX Batch file  |  1992-09-28  |  912b  |  36 lines

  1. /** QsortTest.rexx
  2. *
  3. *   This is a test of QSORT
  4. *
  5. **/
  6. arg names
  7. if names = "" then names = "*"
  8. /*
  9. *   FileList is a rexxarplib function.
  10. *   It returns a stem variable who's elements (files.1, files.2 ...)
  11. *   contain file names. files.0 contains the number of files found.
  12. */
  13. result = FileList(names, files, , E)
  14. say "We have the list of files. Sorting"
  15. do i = 1 to files.0;  say files.i; end
  16. call ListRequest(1, files.0, files, selected, 0, 0, 400, 150, "VLT", SORT)
  17. say "We selected: " selected
  18. /*
  19. *   QSORT is the QuickSort function
  20. *
  21. *   Calling sequence:
  22. *
  23. *   QSORT(first, last, array)
  24. *         first = number of first element to be sorted
  25. *         last  = number of last  element to be sorted
  26. *         array = stem variable array who's elements need to be sorted.
  27. *
  28. */
  29. call QSORT(1, files.0, files)
  30. /*
  31. *   Print the result
  32. */
  33. say ""
  34. say "Same list, but sorted"
  35. do i = 1 to files.0;  say files.i; end
  36.